package com.yonyou.lexue.lexuemgr.service.comment;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.yonyou.lexue.lexuemgr.entity.Comment;
import com.yonyou.lexue.lexuemgr.repository.CommentDao;

@Component
@Transactional
public class CommentService {

	@Autowired
	private CommentDao commentDao;
	
	public void saveComment(Comment entity) {
		commentDao.save(entity);
	}
	
	public List<Comment> getUserComments(String userId,String courseId) {
		return commentDao.findByUserIdAndCourseId(userId, courseId);
	}
	
	public List<Comment> getComments(Integer pageNumber,Integer pageSize,String courseId) {
		return commentDao.findComments(pageNumber, pageSize, courseId);
	}
	
}
